import win32con
import win32api
import time

'''
#模拟按下win键
#按下
win32api.keybd_event(91,0,0,0)
#停顿一下
time.sleep(0.1)
#抬起
win32api.keybd_event(91,0,win32con.KEYEVENTF_KEYUP,0)
'''

#win + D  返回桌面
while True:
    win32api.keybd_event(91,0,0,0)
    win32api.keybd_event(77,0,0,0)
    time.sleep(0.1)
    win32api.keybd_event(77,0,win32con.KEYEVENTF_KEYUP,0)
    win32api.keybd_event(91,0,win32con.KEYEVENTF_KEYUP,0)
    time.sleep(3)